<?php
/**
 * create number
 *
 * @author fusq
 */
class Number {
      
      public static function getNumber(){
          $numberArray = array("0"=>"A","1"=>"B","2"=>"C","3"=>"D","4"=>"E","5"=>"F","6"=>"G","7"=>"H","8"=>"I","9"=>"J");
          $time = mktime() + number_format(microtime(TRUE),2)*100;
          $numbers = str_split(rand(100,999));
          $result = $numberArray[$numbers[0]] . $numberArray[$numbers[1]] . $numberArray[$numbers[2]];
          $result .= $time;
          return $result;
      }

      public static function getOrderNumber(){
          $oPrefix = "O";
          return $oPrefix . Number::getNumber();
      }

      public static function getPackageNumber(){
          $pPrefix = "P";
          return $pPrefix . Number::getNumber();
      }

      public static function getCustomerNumber(){
          $pPrefix = "C";
          return $pPrefix . Number::getNumber();
      }
      
      public static function getTradeLogSN($id,$tradeType){
          $sn = $tradeType.date("YmdHis").substr(strval($id+100000),-5,5);
          return $sn;
      }  

      public static function getGiftCouponCode(){
          $pPrefix = "GC";
          return $pPrefix . Number::getNumber();
      }      
}
?>
